// 引入request模块
import request from '@/utils/request'

// 获取编辑菜单页面信息
export const getEditMenuInfo = (id = -1) => {
  return request({
    method: 'GET',
    // url: '/boss/menu/getEditMenuInfo?id=${id}'
    url: '/boss/menu/getEditMenuInfo',
    params: {
      id: id
    }
  })
}
// 添加菜单接口
export const createOrUpdateMenu = data => {
  return request({
    method: 'POST',
    url: '/boss/menu/saveOrUpdate',
    data
  })
}
// 添加获取所有菜单接口 /boss/menu/getAll
export const getAllMenus = () => {
  return request({
    method: 'GET',
    url: '/boss/menu/getAll'
  })
}
// 添加获取删除菜单接口 /boss/menu/{id}
export const deleteMenu = id => {
  return request({
    method: 'DELETE',
    url: `/boss/menu/${id}`
  })
}
// 添加获取所有菜单并按层级展示的接口 /boss/menu/getMenuNodeList
export const getMenuNodeList = () => {
  return request({
    method: 'GET',
    url: '/boss/menu/getMenuNodeList'
  })
}
// 给角色分配菜单接口  /boss/menu/allocateRoleMenus
export const allocateRoleMenus = data => {
  return request({
    method: 'POST',
    url: '/boss/menu/allocateRoleMenus',
    data
  })
}
// 获取角色拥有的菜单列表接口  /boss/menu/getRoleMenus
export const getRoleMenus = roleId => {
  return request({
    method: 'GET',
    url: '/boss/menu/getRoleMenus',
    params: {
      roleId
    }
  })
}
